﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <script src="../Content/scripts/jquery-1.11.1.min.js"></script>
    <script src="../Content/scripts/bootstrap/bootstrap.min.js"></script>
    <link href="../Content/scripts/plugins/jquery-ui/jquery-ui.min.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/jquery-ui/jquery-ui.min.js"></script>
    <!-- Bootstrap -->
    <link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" />
    <link href="../Content/styles/font-awesome.min.css" rel="stylesheet" />
    <link href="../Content/adminLTE/css/index.css" rel="stylesheet" />
    <link href="../Content/scripts/plugins/jqgrid/jqgrid.css" rel="stylesheet" />
    <link rel="Shortcut icon" href="../images/favicon.ico" />
    <link href="../Content/styles/learun-ui.css" rel="stylesheet" />
    <script src="../Content/scripts/plugins/layout/jquery.layout.js"></script>
    <script src="../Content/scripts/plugins/dialog/dialog.js"></script>
    <script src="../Content/scripts/plugins/jqgrid/grid.locale-cn.js"></script>
    <script src="../Content/scripts/plugins/jqgrid/jqgrid.min.js"></script>
    <script src="../Content/scripts/plugins/validator/validator.js"></script>
    <script src="../Content/scripts/utils/learun-ui.js"></script>
    <script src="../Content/scripts/utils/learun-form.js"></script>
    <script src="../My97DatePicker/WdatePicker.js"></script>
    <style>
        html, body {
            height: 100%;
            width: 100%;
        }
    </style>
</head>
<body>
    <div style="margin-left: 10px; margin-top: 20px; margin-right: 30px;">
        <table class="form" id="personaddform" style="margin-top:10px;">
            <tr>
                <th class="formTitle">用户编号<font face="宋体">*</font></th>
                <td class="formValue">
                    <input id="UserNo" type="text" class="form-control" placeholder="请输入用户编号" isvalid="yes" checkexpession="NotNull" />
                </td>
                <th class="formTitle">用户名<font face="宋体">*</font></th>
                <td class="formValue">
                    <input id="UserName" type="text" class="form-control" placeholder="请输入用户名" isvalid="yes" checkexpession="NotNull" />
                </td>
            </tr>
            <tr>
                <th class="formTitle">密码<font face="宋体">*</font></th>
                <td class="formValue">
                    <input id="Password" type="text" class="form-control"  isvalid="yes" checkexpession="NotNull" />
                </td>
                <th class="formTitle">联系方式<font face="宋体">*</font></th>
                <td class="formValue">
                    <input id="Tel" type="text" class="form-control" placeholder="请输入联系方式" isvalid="yes" checkexpession="NotNull" />
                </td>
            </tr>

            <tr>
                <th class="formTitle">所属客户<font face="宋体">*</font></th>
                <td class="formValue">
                    <select id="CustomerName" class="form-control" onchange="changetype()"></select>
                </td>
                <th class="formTitle">角色名<font face="宋体">*</font></th>
                <td class="formValue">
                    <select id="RoleName" class="form-control">
                        <option value="">请选择</option>
                    </select>
                </td>
            </tr>
       
        </table>
    </div>

    <script src="PersonJS.js"></script>
    <script>
        $.personjs.initCustomerInfo(getCookie("CustomerName"));

        function changetype() {
            $.personjs.initRoleInfo($("#CustomerName").find("option:selected").text());
        }
        
        // 保存表单  
        function AcceptClick(grid) {
            if (!$('#personaddform').Validform()) {
                return false;
            }

            var UserNo = $('#UserNo').val();
            var UserName = $('#UserName').val();
            var Password = $('#Password').val();
            var Tel = $('#Tel').val();
            var CustomerName = $('#CustomerName').find("option:selected").text();
            var RoleName = $('#RoleName').find("option:selected").val();
            
            $.personjs.savePersonInfo(UserNo, UserName, Password, Tel, CustomerName, RoleName, grid);
        }

        // 获取cookie
        function getCookie(c_name) {
            if (document.cookie.length > 0) {
                c_start = document.cookie.indexOf(c_name + "=")
                if (c_start != -1) {
                    c_start = c_start + c_name.length + 1
                    c_end = document.cookie.indexOf(";", c_start)
                    if (c_end == -1) c_end = document.cookie.length
                    return unescape(document.cookie.substring(c_start, c_end))
                }
            }
            return ""
        }

    </script>
</body>
</html>

